var userType=0;
var defaultShopId=null;
var defaultShopName=null;
$(function(){
/*	$.get("../shopUser/find/sessionUserList",function(data){
				if(IsNotEmpty(data)){
					DealAndShowMsg(data,false,false);
					var json=JSON.parse(data);
					if(json.state==0){
						userType=getHtmlInt(getHeadIndexValue(0, json, "userType"));
					if(json.result.data.length>0){
						$("#hlogin").html(getHeadIndexValue(0, json, "userName"));
						for(var i=0;i<json.result.data.length;i++){
							if(getHeadIndexValue(i, json, "Default")){
								$("#slogin").html("&nbsp;"+ getHtmlString(getHeadIndexValue(i, json, "shopName")));
								defaultShopId=getHeadIndexValue(i, json, "shopId");
								defaultShopName=getHeadIndexValue(i, json, "shopName");
							}
						}
					}
					if(userType==1){
					if(json.result.data.length==1){
						$("#shopIsChoosed").attr("checked","checked");
						$("#shopIsChoosed").attr("disabled","disabled");
						var htm="<option selected='selected' value='"+getHtmlInt(getHeadIndexValue(0, json, "shopId"))+"'>"+getHtmlString(getHeadIndexValue(0, json, "shopName"))+"</option>";
						$("#shopName").html(htm);
						$("#shopID").html(htm);
					}
						$(".shopNeedHide").hide();
					}
					}else{
						$("#login").show();
						$("#hlogin").hide();
						$("#loginOut").hide();
						$("#slogin").hide();
					}
				}else{
					$("#login").show();
					$("#hlogin").hide();
					$("#loginOut").hide();
				}
			}	
	);*/
	$.ajax({
		type : "get",
		async:false,
		datatype : "json",
		url : "../shopUser/find/sessionUserList",
		success : function(data){
			if(IsNotEmpty(data)){
				DealAndShowMsg(data,false,false);
				var json=JSON.parse(data);
				if(json.state==0){
					userType=getHtmlInt(getHeadIndexValue(0, json, "userType"));
				if(json.result.data.length>0){
					$("#hlogin").html(getHeadIndexValue(0, json, "userName"));
					for(var i=0;i<json.result.data.length;i++){
						if(getHeadIndexValue(i, json, "Default")){
							$("#slogin").html("&nbsp;"+ getHtmlString(getHeadIndexValue(i, json, "shopName")));
							defaultShopId=getHeadIndexValue(i, json, "shopId");
							defaultShopName=getHeadIndexValue(i, json, "shopName");
						}
					}
				}
				if(json.result.data.length==1){
					$("#shopIsChoosed").attr("checked","checked");
					$("#shopIsChoosed").attr("disabled","disabled");
					var htm="<option selected='selected' value='"+getHtmlInt(getHeadIndexValue(0, json, "shopId"))+"'>"+getHtmlString(getHeadIndexValue(0, json, "shopName"))+"</option>";
					$("#shopName").html(htm);
					$("#shopName").attr("disabled",false);
					$("#shopID").html(htm);
				}
					$(".shopNeedHide").hide();
				
				}else{
					$("#login").show();
					$("#hlogin").hide();
					$("#loginOut").hide();
					$("#slogin").hide();
				}
			}else{
				$("#login").show();
				$("#hlogin").hide();
				$("#loginOut").hide();
			}
		}	
	});
});


function getTaskRemindInfo(){
	 remindIng = setInterval(getTaskRmeind,60*1000);
}
function getTaskRmeind(){
	$.ajax({
		type : "get",
		url : "/DFZKWxWeb/messageRemind/find",
		success : function(data){
			var json=JSON.parse(data);
				if(json.result.data.length>0){
					//clearInterval(remindIng);
				}
			else{
				
			}
		}	
	});
}